<template>
  	<div class="index-free">
		<div class="main">
			<img :src="baseUrl+item" v-for="(item, index) in imagesList" :key="index" />
		</div>
		
		<div class="footer">
			<div class="text" @click="goQues">
				<div class="breathe">立即报名</div>
			</div>
		</div>
	
  	</div>
</template>

<script>
	import axios from 'axios';

	export default {
		data () {
			return {
				baseUrl:`${this.$siteURL}/imgs/mini/`,
				imagesList:[],
				productId:11,
				pathId:''
			}
		},
		created(){
			this.productId = this.$route.query.productId || 11   
			this.getList()
			this.getPathid()
		},
		methods:{
			getList(){
				axios({
					method:'GET',
					url: `${this.$baseURL}/queryById`,
					params:{
						productId: this.productId
					}
				}).then(res => {
					this.imagesList = res.data
				})
			},
			getPathid(){
				let path = encodeURIComponent(window.location.href)
				axios({
					method:'GET',
					url: `${this.$baseURL}/getPathId`,
					params:{
						putIndex: path
					}
				}).then(res => {
					this.pathId = res.data
				})
			},
			goQues(){
				this.doPoint()
				this.$router.push({
					path:'/product/question',
					query: {
						productId: this.productId,
						pathId: this.pathId,
					}
				})
			},
			//埋点
			doPoint(){
				let params = {
					clickId: this.pathId,
					productId: this.productId,
					ecApplyNow: 0
				}
				axios({
					method:"POST",
					url:`${this.$baseURL}/insertApplyEc`,
					params: params
				}).then(res => {
					if(res.data.code == 200){
						//do nothing
					}else{
						this.$message({message: res.data.message});
					}
				})
			}
			
		}
	}
</script>

<style scoped>
	.text{text-decoration: none;}
	.mask{position: fixed;width: 100vw;height: 100vh;background: rgba(0, 0, 0, 0.5);z-index: 99;top: 0;left: 0;}
	.panel{width: 100vw;height: 100vh;display: flex;justify-content: center;align-items: center;}
	.qcode{width: 340px;height: 400px;background: #fff;padding: 20px;text-align: center;}
	.qcode img{max-width: 280px;height: 280px;}
	.text-right{font-size: 20px;text-align: right;}
	.qcode p{color: #000;font-size: 16px;margin-bottom: 2px;}
</style>



